package com.demo.livemanagement.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.demo.livemanagement.domain.LiveInformation;
import com.demo.livemanagement.livedelayqueue.LiveDelayInfo;
import com.demo.livemanagement.mapper.LiveInformationMapper;
import com.demo.livemanagement.service.LiveService;

@Service
public class LiveServiceImpl implements LiveService {

	@Autowired
	private LiveInformationMapper liveInformationMapper;

	@Override
	public Long insertLiveInformation(LiveInformation record) {
		return liveInformationMapper.insertSelective(record) == null ? 0
				: liveInformationMapper.insertSelective(record);
	}

	@Override
	public int timerUpdateLive(Long liveId) {
		LiveInformation record = new LiveInformation();
		record.setLiveMainId(liveId);
		record.setLiveStats("D");
		return liveInformationMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public List<LiveInformation> selectWaitForUpdateLive() {
		return liveInformationMapper.selectliveInformationList(new Date());
	}

	@Override
	public List<LiveDelayInfo> selectWaitForUpdateLiveDelay() {
		return liveInformationMapper.selectliveInformationListDelay(new Date());
	}



}
